import axios from "axios";
// axios.defaults.baseURL = "http://localhost:3000";

//----
// 创建 Axios 实例
const axios1 = axios.create({
  baseURL: "http://localhost:3000", // 设置基础 URL，将作为请求的前缀
});
//----

const token = localStorage.getItem("token");
axios1.defaults.headers.common["Authorization"] = `Bearer ${token}`;

class Http {
  /* 参数超过两个写对象 */
  static request({ url, data = {}, params = {}, method }) {
    return axios1({
      url,
      data,
      params,
      method,
    });
  }
  
}
export { Http };
